import $axios, { Result } from '@/plugins/axios'
import { AxiosResponse } from 'axios'
import { PageParam } from '@/type'

/**
 * 签收查看详情（事项的抄送单位、牵头单位、文件，对应的签收情况）
 * @param data
 */
export async function getMatterReceiveDetail(data: {
  matterId: number
  id: number
}): Promise<AxiosResponse<Result>> {
  return await $axios.post(
    '/supervision-api/receive/getMatterReceiveDetail',
    data,
  )
}

/**
 * 根据事项查询部门签收情况
 * @param matterId 事项ID
 */
export async function getUnitReceive(
  matterId: number,
): Promise<AxiosResponse<Result>> {
  return await $axios.get(`/supervision-api/receive/getUnitReceive/${matterId}`)
}

/**
 * 签收保存
 * @param data
 */
export async function saveReceive(data: any): Promise<AxiosResponse<Result>> {
  return await $axios.post('/supervision-api/receive/saveReceive', data)
}

/**
 * 更新签收信息
 * @param data
 */
export async function updateReceive(data: any): Promise<AxiosResponse<Result>> {
  return await $axios.post('/supervision-api/receive/modifyReceive', data)
}

/**
 * 分页查询签收的任务
 * @param pageParam
 */
export async function getReceiveByPage(
  pageParam: PageParam,
): Promise<AxiosResponse<Result>> {
  return await $axios.post(
    '/supervision-api/receive/getReceiveByPage',
    pageParam,
  )
}
